package com.skillworld.webapp.model.departmentservice;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.skillworld.webapp.model.department.Department;
import com.skillworld.webapp.model.department.DepartmentDao;

import es.udc.pojo.modelutil.exceptions.InstanceNotFoundException;

@Service("DepartmentService")
@Transactional
public class DepartmentServiceImpl implements DepartmentService
{	
    @Autowired
    private DepartmentDao departmentDao;


    @Transactional(readOnly = true)
	public List<Department> listDepartments()
	{
        return departmentDao.findAll();
	}

	@Transactional(readOnly = true)
    public Department viewDepartment(Long idDepartmet) throws InstanceNotFoundException {
        
            return departmentDao.findById(idDepartmet);
    }
}
